package com.warom.sdg.util;

/**
 * 常量定义类
 */
public class Constants {
    
    /**
     * API基础URL
     * 可通过ConfigManager动态配置
     */
    public static String API_BASE_URL = "http://222.222.67.42:19995";
    
    /**
     * 数据上报API地址
     */
    public static String API_REPORT_DATA_URL = API_BASE_URL + "/sgd/EquipmentDocking/obtainDetectionData";
    
    /**
     * 设备状态上报API地址
     */
    public static String API_REPORT_DEVICE_STATUS_URL = API_BASE_URL + "/device/status";
    
    /**
     * 开放平台API基础URL
     */
    public static String OPEN_API_BASE_URL = "http://openapi.ccai.com.cn";
    
    /**
     * 获取设备直播地址API
     */
    public static String API_LIVE_STREAM = OPEN_API_BASE_URL + "/openapi/live/stream";
    
    /**
     * 设备唤醒API
     */
    public static String API_DEVICE_WAKEUP = OPEN_API_BASE_URL + "/openapi/live/wakeup";
    
    /**
     * 获取设备截图API
     */
    public static String API_DEVICE_SCREENSHOT = OPEN_API_BASE_URL + "/openapi/live/capture";
    
    /**
     * 设置API基础URL
     * @param baseUrl 新的基础URL
     */
    public static void setApiBaseUrl(String baseUrl) {
        if (baseUrl != null && !baseUrl.isEmpty()) {
            // 确保URL以/结尾
            if (!baseUrl.endsWith("/")) {
                baseUrl = baseUrl + "/";
            }
            
            API_BASE_URL = baseUrl;
            
            // 更新其他相关URL
            API_REPORT_DATA_URL = API_BASE_URL + "data/report";
            API_REPORT_DEVICE_STATUS_URL = API_BASE_URL + "device/status";
        }
    }
    
    /**
     * 设置开放平台API基础URL
     * @param baseUrl 新的开放平台基础URL
     */
    public static void setOpenApiBaseUrl(String baseUrl) {
        if (baseUrl != null && !baseUrl.isEmpty()) {
            // 确保URL不以/结尾
            if (baseUrl.endsWith("/")) {
                baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
            }
            
            OPEN_API_BASE_URL = baseUrl;
            
            // 更新相关URL
            API_LIVE_STREAM = OPEN_API_BASE_URL + "/openapi/live/stream";
            API_DEVICE_WAKEUP = OPEN_API_BASE_URL + "/openapi/live/wakeup";
            API_DEVICE_SCREENSHOT = OPEN_API_BASE_URL + "/openapi/live/capture";
        }
    }
} 